import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import DataTest from '@/views/DataTest.vue'
import ModelTest from '@/views/ModelTest.vue'
import Visualization from '@/views/Visualization.vue'
import Configuration from '@/views/Configuration.vue'
import PlanComparison from '@/views/PlanComparison.vue'
import ApiExample from '@/components/ApiExample.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { title: '首页' }
  },
  {
    path: '/data-test',
    name: 'DataTest',
    component: DataTest,
    meta: { title: '数据测试' }
  },
  {
    path: '/model-test',
    
    name: 'ModelTest',
    component: ModelTest,
    meta: { title: '模型测试' }
  },
  {
    path: '/visualization',
    name: 'Visualization',
    component: Visualization,
    meta: { title: '数据可视化' }
  },
  {
    path: '/plan-comparison',
    name: 'PlanComparison',
    component: PlanComparison,
    meta: { title: '方案比对' }
  },
  {
    path: '/configuration',
    name: 'Configuration',
    component: Configuration,
    meta: { title: '系统配置' }
  },
  {
    path: '/exampleApi',
    name: 'ApiExample',
    component: ApiExample,
    meta: { title: 'API示例' }
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title ? `${to.meta.title} - APS智能排期系统` : 'APS智能排期系统'
  next()
})

export default router 